#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define y1 y666
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;


ll a, b, x1, y1, x2, y2;

void load()
{
	cin >> a >> b >> x1 >> y1 >> x2 >> y2;
}

void solve()
{
	ll p1 = (x1 + y1) / (2 * a);
	if (p1 * (2 * a) > (x1 + y1)) p1--;
	ll q1 = (x1 - y1) / (2 * b);
	if (q1 * (2 * b) > (x1 - y1)) q1--;

	ll p2 = (x2 + y2) / (2 * a);
	if (p2 * (2 * a) > (x2 + y2)) p2--;
	ll q2 = (x2 - y2) / (2 * b);
	if (q2 * (2 * b) > (x2 - y2)) q2--;
	cerr << p1 << " " << q1 << " " << p2 << " " << q2 << "\n";
	cout << abs(p1 - p2) + abs(q1 - q2) - min(abs(p1 - p2), abs(q1 - q2));



}

#define file "b"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	load();
	solve();
	return 0;
}
